<div class="col-md-12">
	<form method="post" class="form-horizontal" action="${cxt!}/wealthcollege/addBook" id="wcbook" >
		<div class="form-group">
			<div class="row">
				<div class="col-md-1"></div>
				<div class="col-md-5">
					<label class="col-md-3 ">${_res["wealth.book.cover"]}:<span class="fontColorRed">&nbsp;*</span></label>
				</div>
				<div class="col-md-1"></div>
				<div class="col-md-5">
					<label class="col-md-3 ">${_res["wealth.book.content"]}:<span class="fontColorRed">&nbsp;*</span></label>
				</div>
			</div>

			<div class="row">
				<div class="col-md-1"></div>
				<!-- 上传封面 -->
				<div class="col-md-5">
					<div class="col-md-3 proimgfiles">
						<a href="javascript:void(0)" class="filesIconAdd" id="uploadproimgfiles">
							<!-- //ajax片段开始 -->
							<%  #ajax uploadproimgfiles: {%> 
								<% if(uploadFile! !=null) {%> 
									<input type="hidden" name="wealthCollegeBook.coverpricureurl" value="${uploadFile.path!}" /> 
									<img src="${imgCxt!}/${uploadFile.path!}" width="100%" height="100%" style="position: relative; z-index: 99999;">
								<% } %> 
							<% } %>
							<!-- //ajax片段结尾 -->
						</a> 
						<input type="file" style="opacity: 0" id="fileuploadproimgfiles" name="coverpricureurl" />
					</div>
				</div>

				<!-- 上传文件 -->
				<div class="col-md-1"></div>	
				<div class="col-md-5">
					<div class="col-md-3 proimgfiles">
						<a href="javascript:void(0)" class="filesIconAdd" id="uploadDatumFile">
							<!-- //ajax片段开始  -->
							<% #ajax uploadDatumFile: {%> 
								<% if (uploadFiles! != null) { %>
									<input type="hidden" name="wealthCollegeBook.contenturl" value="${uploadFiles.path!}" />
									<img src="${cxt!}/img/cover.png" width="100%" height="100%" style="position: relative; z-index: 99999;" id="imgCxt">
								<% } %>
							<% } %>
							<!-- //ajax片段结尾 -->
						</a> 
						<input type="file" style="opacity: 0" id="fileuploadDatumFile" name="contenurl" />
					</div>
				</div>
			</div>
		</div>

		<div class="form-group">
			<div class="row">
				<div class="col-md-3">
					<label class="col-md-6 control-label">${_res["wealth.college.bookname"]}:<span class="fontColorRed">&nbsp;*</span></label>
				</div>
				<div class="col-md-3">
					<input type="text" class="form-control"
						name="wealthCollegeBook.bookname" required aria-required="true">
				</div>
			</div>
		</div>
		<div class="form-group">
			<div class="row">
				<div class="col-md-3">
					<label class="col-md-6 control-label">${_res["wealth.college.theme.introduction"]}:<span class="fontColorRed">&nbsp;*</span></label>
				</div>
				<div class="col-md-4">
					<textarea class="form-control" name="wealthCollegeBook.bookintroduce" style="width: 140%"></textarea>
				</div>
			</div>
		</div>
		<div class="form-group">
			<div class="row">
				<div class="col-md-3">
					<label class="col-md-6 control-label">${_res["wealth.book.isfree"]}:<span class="fontColorRed">&nbsp;*</span></label>
				</div>
				<div class="col-md-5">
					<#dict type="radio"  name="wealthCollegeBook.isfree" dictCode="COMMON_YN" defaultValue="${updateBook.isfree!}"/>
				</div>
			</div>
		</div>
		<div class="form-group">
			<div class="row">
				<div class="col-md-3">
					<label class="col-md-6 control-label">${_res["wealth.college.bookprice"]}:<span class="fontColorRed">&nbsp;*</span></label>
				</div>
				<div class="col-md-3">
					<input type="text" class="form-control" name="wealthCollegeBook.price" required aria-required="true">
				</div>
			</div>
		</div>
		<div class="form-group">
			<div class="row">
				<div class="col-md-3">
					<label class="col-md-6 control-label">${_res["wealth.college.usergroup"]}:<span class="fontColorRed">&nbsp;*</span></label>
				</div>
				<div class="col-md-3" >
					<#dict type="select" name="wealthCollegeBook.usergroup" multiple="multiple"  table="customer_role" filedName="name" filedValue="code"/>
				</div>
		    </div>
		</div>
		
		<div class="form-group">
			<div class="row">
				<div class="col-md-6">
					<label class="col-md-12 control-label "> 
						<% if(hasPrivilegeUrl("getWcbookList")){ %>
							<button type="button" class="btn btn-warning" onClick="ajaxContent('/wealthcollege/getWcbookList');">${_res["system.return"]}</button>
						<% } %> 
						<% if(hasPrivilegeUrl("/wealthcollege/addBook")){ %>
							<button type="submit" class="btn btn-primary"> ${_res["system.submit"]} </button> 
						<% } %> 
					</label>
				</div>
			</div>
		</div>
	</form>
</div>
<#submit formId="wcbook" divId="content" />

<script>
	$(document).ready(function() {
		$("a[id^='upload']").on('click', function() {
			var id = $(this).attr("id");
			$("#file" + id).click();
		});
	
		// 选择文件之后执行上传ajaxFileUpload2(divId,fileElementId,toUrl,uploadType,uploadFiles,callback)
		$("input[id^='fileuploadproimgfiles']").on("change", function() {
			var fileElementId = $(this).attr("id");
			ajaxFileUpload2("uploadproimgfiles" , fileElementId , "/realty/wealthcollege/addbook.html#uploadproimgfiles" , "book","uploadFile");
		});
		
		// 选择文件之后执行上传
		$("input[id^='fileuploadDatumFile'").on("change", function() {
			var fileElementId = $(this).attr("id");
			ajaxFileUpload2("uploadDatumFile",fileElementId,"/realty/wealthcollege/addbook.html#uploadDatumFile","book","uploadFiles");
		});
	});
</script>